package com.eastfair.home.service.impl;

import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.home.service.HomeReportVenueDrawingAuditHistoryService;
import com.eastfair.venuebooking.api.ReportVenueDrawingAuditHistoryFeign;
import com.eastfair.venueservice.vo.ReportVenueDrawingAuditHistoryVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 一键报馆图纸审核记录历史 service.
 *
 * @author dqq
 * @date 2022 /9/17
 */
@Service
@Slf4j
public class HomeReportVenueDrawingAuditHistoryServiceImpl implements HomeReportVenueDrawingAuditHistoryService {

    @Resource
    private ReportVenueDrawingAuditHistoryFeign reportVenueDrawingAuditHistoryFeign;

    @Override
    public List<ReportVenueDrawingAuditHistoryVO> queryByReportVenueDrawingCategoryAuditHistoryId(Long reportVenueDrawingCategoryAuditHistoryId) {
        log.info("queryByReportVenueDrawingCategoryAuditHistoryId - 图纸分类审核历史ID查询图纸历史列表, reportVenueDrawingCategoryAuditHistoryId={}",
                reportVenueDrawingCategoryAuditHistoryId);
        R<List<ReportVenueDrawingAuditHistoryVO>> result = reportVenueDrawingAuditHistoryFeign
                .queryByReportVenueDrawingCategoryAuditHistoryId(reportVenueDrawingCategoryAuditHistoryId);
        log.info("queryByReportVenueDrawingCategoryAuditHistoryId - 完成, result={}", result);
        if (!result.getIsSuccess()) {
            throw BizException.wrap(result.getCode(), result.getMsg());
        }
        return result.getData();
    }
}